﻿using System.Collections.Generic;

namespace DHJ.Cost.Timing
{
    public class OccurrenceTimeComparer : IComparer<OccurrenceTime>
    {
        public int Compare(OccurrenceTime x, OccurrenceTime y)
        {
            if (x == null && y == null) return 0;
            if (x == null) return -1;
            if (y == null) return 1;

            var a = x.Year - y.Year;
            if (a != 0) return a;
            return x.Month - y.Month;
        }
    }
}